# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=gzdoom
pkgver=4.10.0
pkgrel=4
pkgdesc="Feature centric port for all Doom engine games"
url="https://www.zdoom.org/"
# ppc64le blocked by zmusic
# x86 blocked by sse2
# riscv64 fails to build, link-make applet not found
# 32-bit builds blocked by src/common/engine/i_interface.cpp:4:29 (error: static assertion failed: 32 builds are not supported)
# s390x: mainframe
arch="aarch64 x86_64"
license="GPL-3.0-or-later"
depends="fluidsynth"
makedepends="
	bzip2-dev
	cmake
	gtk+3.0-dev
	libgme-dev
	libjpeg-turbo-dev
	libsndfile-dev
	libvpx-dev
	mesa-dev
	mpg123-dev
	musl-fts-dev
	nasm
	openal-soft-dev
	samurai
	sdl2-dev
	vulkan-loader-dev
	zlib-dev
	zmusic-dev
	"
subpackages="$pkgname-doc"

source="
	https://github.com/coelckers/gzdoom/archive/refs/tags/g$pkgver.tar.gz
	0001-link-zipdir-against-fts.patch
	0002-fix-musl-fts.patch
	0003-define-cpu_set_t.patch
	gcc13.patch
	no-execinfo.patch
	force-include-order.patch
	cmake-version.patch
	"
builddir="$srcdir/$pkgname-g$pkgver"
options="!check" # No test suite

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DDYN_GTK=OFF \
		-DDYN_OPENAL=OFF \
		-DALPINE_PKGVER="$pkgver" \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
fd2f6e34aaa59e3d153de6359211082398878dae3d396ab55fc736f94e1378d5e03193d7912a29a531cf1dc255d30af63ad1c6472784e3745db6ac4a3a9e6fe6  g4.10.0.tar.gz
7e2f5e593cabf618c2e5c520380af01ba4aa3fef9955a6305888d2bb017af25579ee02bd16b6c6080ac4e823498b224edb553f998b8a6d7833d4789070931c38  0001-link-zipdir-against-fts.patch
7fed60cb9006653c9a85c226e98efae02b3f7f6bd34c47db03f29bc98bf1584f7e128394ab920956d799efa6bace3605f628fd806e130410243e3fdc78b417bc  0002-fix-musl-fts.patch
507a8297823856348eacc1adc62f99d01c4bcf90d94c0ba4517b94d9d6adccbfaeec67588303bbb37eca03d3f2033fd060d034db433f35484e39d8dd4ff8773a  0003-define-cpu_set_t.patch
91063a413fd1e6f9756b4b8a2e4c519418f4b6cc65c50b03de2b984652914c40657630813dbb8f83cfeb228fb32f707ed53ce1362ff63e9130c0ac98dfb25147  gcc13.patch
aa2a476aa804c0e0d6f2730f0d46c84810d7cc48f88b9222aac22f0747e233b4a6dcc1986b923ba8dcbd9d293378c00595666260ce86858db35841c4c05ed90b  no-execinfo.patch
4d943355082566c980cab936df3085399e728846577d559633fb75b4cc09304b3386979a5681b3423fa7f9d5d913c1d2932470892b45198b885b6923bdcfb995  force-include-order.patch
be700d296aebfbd26d280eaae6192788915c3fc13fb87b49e68512b6aa8cfddd41132c6f694086d872ba886e0853f3cbf182d7b8871296f1c663623aac919cba  cmake-version.patch
"
